-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merge the CLI 'installValues' type with Helm 'Values' type #3291
Conversation
Signed-off-by: Ivan Sim <ivan@buoyant.io>
Signed-off-by: Ivan Sim <ivan@buoyant.io>
Signed-off-by: Ivan Sim <ivan@buoyant.io>
Signed-off-by: Ivan Sim <ivan@buoyant.io>
Signed-off-by: Ivan Sim <ivan@buoyant.io>
Signed-off-by: Ivan Sim <ivan@buoyant.io>
Integration test results for b871fa6: success 🎉 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks awesome, thanks!
The new install_helm_test.go
is sweet 👍 . Given the scaffolding already in place in that file, could you add a test there for HA
?
Also a small TIOLI suggestion for values.go
that makes it slightly simpler, avoiding a couple of pointers and dereferencing steps. Let me know what you think:
diff --git a/pkg/charts/values.go b/pkg/charts/values.go
index f8caf2a0..d9575bd2 100644
--- a/pkg/charts/values.go
+++ b/pkg/charts/values.go
@@ -223,12 +223,11 @@ func readDefaults(chartDir string, ha bool) (*Values, error) {
return nil, err
}
- merged, err := values.merge(v)
+ var err error
+ values, err = values.merge(v)
if err != nil {
return nil, err
}
-
- values = *merged
}
return &values, nil
@@ -237,14 +236,13 @@ func readDefaults(chartDir string, ha bool) (*Values, error) {
// merge merges the non-empty properties of src into v.
// A new Values instance is returned. Neither src nor v are mutated after
// calling merge.
-func (v Values) merge(src Values) (*Values, error) {
+func (v Values) merge(src Values) (Values, error) {
// By default, mergo.Merge doesn't overwrite any existing non-empty values
// in src. So in HA mode, we are merging values.yaml into values-ha.yaml
// so that all the HA values take precedence.
if err := mergo.Merge(&src, v); err != nil {
- return nil, err
+ return Values{}, err
}
- newValue := src
- return &newValue, nil
+ return src, nil
}
Signed-off-by: Ivan Sim <ivan@buoyant.io>
Signed-off-by: Ivan Sim <ivan@buoyant.io>
Signed-off-by: Ivan Sim <ivan@buoyant.io>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me 👍 🎸
Integration test results for c837f23: success 🎉 |
This PR merges the
cmd.installValues
type with thecharts.Values
type. This merge ensures that all the variables and defaults defined in the CLI and Helm chart are found in one place (i.e.pkg/charts/values.go
). It also moves many of the Helm-related code out of the CLI package.Also, added unit test to validate the YAML output generated by the Helm renderer, using defaults from the
values.yaml
file.Fixes #3237.